package main

import (
	"cluster-cache/http"
	"cluster-cache/rpc"
	"flag"
	"log"
	ht "net/http"
	_ "net/http/pprof"
	"os"
)

var hostPort = flag.String("h", "0.0.0.0:8080", "listened ip and port")
var id = flag.String("i", "", "listened id")
var profPort = flag.String("p", "9090", "init prof port")

func main() {
	flag.Parse()
	//go startPprof()
	server := rpc.NewHttpServerV1(*hostPort, http.NewRouter(*id))
	server.Start()
}

func startPprof() {
	if err := ht.ListenAndServe("0.0.0.0:"+*profPort, nil); err != nil {
		log.Fatal(err)
	}
	os.Exit(0)
}
